package com.cmc.cloud.cmclink.doc.vo.sovo.sovo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * @author 陈正
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SoBsaSecondCountVO {
    @Schema(description = "接货地")
    private String porCode;
    @Schema(description = "装货港")
    private String polCode;
    @Schema(description = "卸货港")
    private String podCode;
    @Schema(description = "目的地")
    private String delCode;
    @Schema(description = "货物类型")
    private String cargoType;
    @Schema(description = "箱型", example = "2")
    private String cntrType;
    @Schema(description = "箱尺寸")
    private String cntrSize;
    @Schema(description = "已接Unit")
    private long receivedUnit;
    @Schema(description = "待接Unit")
    private long waitUnit;
    @Schema(description = "已接TEU")
    private BigDecimal receivedTeu ;
    @Schema(description = "待接TEU")
    private BigDecimal waitTeu ;
    @Schema(description = "已接TONS(箱货总重)")
    private BigDecimal receivedWgtTons ;
    @Schema(description = "待接TONS(箱货总重)")
    private BigDecimal waitWgtTons ;

    public BigDecimal getReceivedTeu() {
        if(receivedTeu == null) {
            return BigDecimal.ZERO;
        }
        return receivedTeu;
    }

    public BigDecimal getWaitTeu() {
        if(waitTeu == null) {
            return BigDecimal.ZERO;
        }
        return waitTeu;
    }

    public BigDecimal getReceivedWgtTons() {
        if(receivedWgtTons == null) {
            return BigDecimal.ZERO;
        }
        return receivedWgtTons.divide(new BigDecimal(1000), 3);
    }

    public BigDecimal getWaitWgtTons() {
        if(waitWgtTons == null) {
            return BigDecimal.ZERO;
        }
        return waitWgtTons.divide(new BigDecimal(1000), 3);
    }
}
